package svgedit.gui;

import java.awt.BasicStroke;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;

/**
 * This class draws a rectangle selection stroke around a shape
 * 
 * @author SARJ
 * 
 */
public class SelectionRectStroke implements Stroke
{

	@Override
	public Shape createStrokedShape(Shape shape)
	{

		Rectangle rect = new Rectangle(shape.getBounds());
		// The spaces in the dash
		float dash[] = { 5f, 5f };
		float offset = 5f;

		// Construct the stroke with these params to give it the lined effect
		// Create it around the selectRect
		Shape strokedShape = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
				BasicStroke.JOIN_MITER, 10.0f, dash, offset)
				.createStrokedShape(rect);

		return strokedShape;
	}

}
